<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     default_iphone
 * @copyright   Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/* @var $this Mage_Wishlist_Block_Customer_Wishlist */
?>
<div class="in-page">
    <div class="page-head"><h3><?php echo $this->__('My Wishlist') ?></h3></div>
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <?php if ($this->hasWishlistItems()): ?>
        <?php if ($this->helper('wishlist')->isRssAllow()): ?>
            <p class="a-right"><a href="<?php echo $this->helper('wishlist')->getRssUrl(); ?>" class="link-feed"><?php echo $this->__('RSS Feed') ?></a></p>
        <?php endif; ?>
    <form action="<?php echo $this->getUrl('*/*/update') ?>" method="post">
        <?php echo $this->getBlockHtml('formkey')?>
        <table cellspacing="0" class="shopping-cart product-data" id="wishlist-table">
            <thead>
                <tr>
                    <th><?php echo $this->__('Product') ?></th>
                    <th><?php echo $this->__('Added') ?></th>
                    <th class="a-center"><?php echo $this->__('Action') ?></th>
                </tr>
            </thead>
            <tbody>
            <?php foreach($this->getWishlistItems() as $item): ?>
                <tr class="td-noborder">
                    <td style="padding-top:15px;">
                        <div><a href="<?php echo $this->getProductUrl($item) ?>"><img src="<?php echo $this->helper('catalog/image')->init($item, 'small_image')->resize(100, 100); ?>" alt="<?php echo $this->htmlEscape($item->getName()) ?>" width="100" /></a></div>
                        <div><a href="<?php echo $this->getProductUrl($item) ?>" title="<?php echo $this->htmlEscape($item->getName()) ?>"><?php echo $this->htmlEscape($item->getName()) ?></a></div>
                        <?php echo $this->getPriceHtml($item) ?>
                    </td>
                    <td class="a-center">
                        <?php echo $this->getFormatedDate($item->getAddedAt()) ?>
                    </td>
                    <td class="a-center">
                    <?php if($item->isSaleable()): ?>
                        <a href="<?php echo $this->getItemAddToCartUrl($item) ?>" class="link-cart"><?php echo $this->__('Add to Cart') ?></a><br />
                    <?php endif; ?>
                        <br /><a href="<?php echo $this->getItemRemoveUrl($item) ?>" onclick="return confirmRemoveWishlistItem();" class="link-remove" ><?php echo $this->__('Remove') ?></a>
                    </td>
                </tr>
                <tr>
                    <td colspan="3" style="padding-bottom:15px;">
                        <?php echo $this->__('Comment') ?>:
                        <textarea name="description[<?php echo $item->getWishlistItemId() ?>]" class="input-text" rows="3" cols="3" style="padding:3px;width:98%;height:40px;" onfocus="focusComment(this)" onblur="focusComment(this)"><?php echo $this->hasDescription($item) ? $this->getEscapedDescription($item) : $this->helper('wishlist')->defaultCommentString() ?></textarea>
                    </td>
                </tr>
            <?php endforeach ?>
            </tbody>
        </table>
        <script type="text/javascript">decorateTable('wishlist-table')</script>
        <div class="small-buttons a-center nobr">
            <button type="submit" onclick="this.name='save_and_share'" class="form-button-alt"><span><?php echo $this->__('Share Wishlist') ?></span></button>
            <?php if($this->isSaleable()):?>
            <button onclick="setLocation('<?php echo $this->getUrl('*/*/allcart') ?>')" class="form-button-alt"  type="button"><span><?php echo $this->__('Add All to Cart') ?></span></button>
            <?php endif;?>
            <button type="submit" onclick="this.name='do'" class="form-button"><span><?php echo $this->__('Update Wishlist') ?></span></button>
        </div>
    </form>
    <?php else: ?>
        <p><?php echo $this->__('You have no items in your wishlist.') ?></p>
    <?php endif ?>
    <br /><div class="button-set">
        <a href="<?php echo $this->getBackUrl() ?>" class="left">&laquo; <?php echo $this->__('Back') ?></a>
    </div><br /><br />
</div>
<script type="text/javascript">
    function confirmRemoveWishlistItem() {
        return confirm('<?php echo $this->__('Are you sure you want to remove this product from your wishlist?') ?>');
    }

    function focusComment(obj) {
        if( obj.value == '<?php echo $this->__('Please, enter your comments...') ?>' ) {
            obj.value = '';
        } else if( obj.value == '' ) {
            obj.value = '<?php echo $this->__('Please, enter your comments...') ?>';
        }
    }
</script>
